package ioexercise;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        //单字节文件复制
        FileInputStream fis=new FileInputStream("1.jpg");
        FileOutputStream fos=new FileOutputStream("1_copy.jpg");
        int a;
        long start=System.currentTimeMillis();
        while ((a=fis.read())!=-1){
            fos.write(a);
        }
        long end=System.currentTimeMillis();

        System.out.println("复制结束,耗时："+(end-start));
        fis.close();
        fos.close();
    }
}
